/**
 * 历史记录查看对话框
 * @param targetTable 单据名称
 * @param targetId 单据ID
 * zhangnf 20151009
 */
var historyCtrl  = new XFApp.client();
XFApp.client.prototype.history = {
		getData : function(targetTable,targetId){
			$.ajax({
			    url:basePath+"/log/getList",
			    data:{targetTable:targetTable,targetId:targetId},  
			    type:'post',  
			    cache:false,  
			    dataType:'json',  
			    success:function(data) {
			    	if(true == data.isSuccess){
			    		data = data.result;
			    		var html = '';
			    		html+='<div>'
				    	      +'<table class="table table-bordered" style="margin-bottom:0px;">'
				    	      +'<thead>'
				    	      +'<tr><th width="90px">报文名称</th><th width="90px">状态</th><th width="90px">数据类型</th><th width="90px">内容</th><th width="90px">备注</th><th>报文时间</th></tr>'
				    	      +'</thead>'
				    	    +'</table>'
				    	  +'</div>';
			    		html += '<div class="" style="width:600px;height:200px; overflow-y:auto;">';
						html += '<table class="table table-bordered">';
						for(var index in data){
							if(index == 0){
								html += '<tr>'
									+ '<td width="90px">'
									+ data[index].action
									+ '</td>'
									+ '<td  width="90px">'
									+ "".getString(data[index].contentInfo)
									+ '</td>'
									+ '<td width="90px" title="'+data[index].computerName+'">'
									+"".subString(data[index].computerName,5)
									+ '</td>'
									+ '<td width="90px" title="'+data[index].content+'">'
									+ "".subString(data[index].content,8)
									+ '</td>'
									+ '<td width="90px" title="'+data[index].loginName+'">'
									+ "".subString(data[index].loginName,5)
									+ '</td>'
									+ '<td>'
									+ data[index].actionTime
									+ '</td>'
									+ '</tr>';
							}else{
								html += '<tr>'
									+ '<td>'
									+ data[index].action
									+ '</td>'
									+ '<td>'
									+ "".getString(data[index].contentInfo)
									+ '</td>'
									+ '<td title="'+data[index].computerName+'">'
									+"".subString(data[index].computerName,5)
									+ '</td>'
									+ '<td title="'+data[index].content+'">'
									+ "".subString(data[index].content,8)
									+ '</td>'
									+ '<td title="'+data[index].loginName+'">'
									+ "".subString(data[index].loginName,5)
									+ '</td>'
									+ '<td>'
									+ data[index].actionTime
									+ '</td>'
									+ '</tr>';
							}
						}
						html += '</table></div></div>'
						webAlert({
							title: '操作历史 ',
				            content:html
				            });
			    	}
			     },  
			     error : function() {
			    	 webAlert({
			              title:'提示',
			              content:'操作失败!',
			              opacity:.5,
			              bg:"gray",
			              width:310,
			              height:10,
			              button:[
			                      {
			                      name:"关闭",
			                      callback:function(){
			                    	  return true;
			                      }
			                      }]
			              });
			     }  
			});
			
		}
}